package cn.sccl.dirms.security.model;

import cn.sccl.common.model.BaseModel;
import cn.sccl.common.exception.BusinessException;

/**
* 用户与角色关联关系
* 数据库表 T_SEC_USERS_ROLES 的实体对象
* Created by 杨浩宇 on 2016-07-25.
*/
public class UserAndRole extends BaseModel {
/**
*表名
*/
public final static String TABLE_NAME ="t_sec_users_roles";

    private java.lang.String userId;//用户ID
    private java.lang.String roleId;//角色ID

    public void setUserId(java.lang.String userId){
    this.userId = userId;
    }

        public java.lang.String getUserId(){
    return this.userId;
    }
    public void setRoleId(java.lang.String roleId){
    this.roleId = roleId;
    }

        public java.lang.String getRoleId(){
    return this.roleId;
    }

/**
* clone一个对象。
* @param cls 需要克隆的对象类型，只能是当前类的子类
* @param
<T>
    * @return
    * @throws IllegalAccessException
    * @throws InstantiationException
    */
    public
    <T extends UserAndRole> T clone(Class
        <T> cls) {
            try {
            T t = cls.newInstance();
            t.setUserId(this.
            getUserId());
            t.setRoleId(this.
            getRoleId());
            t.setCreateTime(this.
            getCreateTime());
            t.setUpdateTime(this.
            getUpdateTime());
            t.setDeleteFlag(this.isDeleteFlag());
            t.setId(this.
            getId());
            return t;
            } catch (Exception e) {
            e.printStackTrace();
            throw new BusinessException("对象克隆失败，请克隆的目标对象是否具有无参的构造函数。", e.getCause());
            }
            }
            }